{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext rpy2.ipython\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame(\n",
    "    {\n",
    "        \"Letter\": [\"a\", \"a\", \"a\", \"b\", \"b\", \"b\", \"c\", \"c\", \"c\"],\n",
    "        \"X\": [4, 3, 5, 2, 1, 7, 7, 5, 9],\n",
    "        \"Y\": [0, 4, 3, 6, 7, 10, 11, 9, 13],\n",
    "        \"Z\": [1, 2, 3, 1, 2, 3, 1, 2, 3],\n",
    "    }\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Marco\\AppData\\Local\\conda\\conda\\envs\\python3\\lib\\site-packages\\rpy2-2.9.4-py3.6-win-amd64.egg\\rpy2\\robjects\\pandas2ri.py:191: FutureWarning: from_items is deprecated. Please use DataFrame.from_dict(dict(items), ...) instead. DataFrame.from_dict(OrderedDict(items)) may be used to preserve the key order.\n",
      "  res = PandasDataFrame.from_items(items)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAMAAABKCk6nAAAA51BMVEUAAAAAADoAAGYAOmYAOpAAZrYAujgzMzM6AAA6ADo6AGY6Ojo6OmY6OpA6ZrY6kNtNTU1NTW5NTY5NbqtNjshhnP9mAABmAGZmOgBmOpBmZmZmZrZmkNtmtv9uTU1uTY5ujshuq+SOTU2OTY6ObquOjsiOq+SOyP+QOgCQOjqQOmaQ2/+rbk2r5P+2ZgC2Zjq2tv+2/9u2///Ijk3Ijm7Ijo7IyP/I///bkDrbkGbb/7bb/9vb///kq27kq47k///r6+vy8vL4dm3/tmb/yI7/25D/29v/5Kv//7b//8j//9v//+T///9WgT5BAAAMl0lEQVR4nO3dDXcbRxWH8QVsOSkUqzRym0IKoS82deJCE4gBJwXJwrKz3//z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ll18wj23aFEFktmEwFOqQLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSARwU+P2L/hOA9YtFA758Xr46ThZ4GHux/IHfvayMy4ODA+sSEWY4HKo3oSvTCvy6Bi45guNnyiM4UeBEqy4Bp30fnGjVJWAeRaexWDTg2/HdoUQWS2YTAU6pAthSAQywugLYUgEMsLoC2FIBDLC6AthSAQywugLYUgEMsLoC2FIBDLC6AthSARwJOPy4vswr38U2GoC7u9hGA3B3F9toJMCM3wCc+QCc+QCc+fgCX/+5/7s35ew1uZ+9jL3YYpHbFwBHnLf9fv956bRnDxlf4LfH5dvq13D9ncNii0VuX8Ifd/7+pnTas4eM+030ZfW7vvq6//nPsVdaLHL7JpyoU6/hsmcPGW/g62+r3Z/+Mq6+j73UYpHXPsCzA9hnzx4yzsDX37yZf+XxO68X8TmCr/60smgy4wt89cfad3pffBn9bnGxiM998JzVZc8eMr7Ar6rHmtNbaZcHtrNFvBarZP0We8DwPDjzATjzATjzATjzATjzATjzyRv4fO+iLM/21ZuhnLyBy7PDcrTTvrkDT7742w8/qTdCOpkDl6PimXoTtJM78PlXu30LnTvw+NN/n+z2IZw38M1fTsvxJzt9J5w18M3JYTl/rrSzkzUwA3D2A3DmA3DmA3DmA3DmA3Dm83+FBtiCx0wn2wAAAABJRU5ErkJggg==\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%R -i df\n",
    "library(\"ggplot2\")\n",
    "ggplot(data = df) + geom_point(aes(x = X, y = Y, color = Letter, size = Z))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
